﻿using System.Collections.Generic;
using System.Linq;
using System.Threading;

namespace MyWebApp.Data
{
    public class FakeBikesSearchService : IBikesSearchService
    {
        public IEnumerable<Bike> GetBikes(string name, int categoryId, int stateId, int pageNumber, out int numberOfItemsFound)
        {
           
            Thread.Sleep(100);

            var bikes = new List<Bike>
                {
                    new Bike
                        {
                            AuctionPlatform =  "Allegro.pl",
                            //PostedOn = DateTime.Now.AddDays(-2),
                            Description = "fully equipped downhill bike bike, sram, marzochi!",
                            Name = "Specialized",
                            Price = 3370,
                            ThumbnailUrl = "bootstrap/sample/specialized.jpg",
                            SmallestThumbnailUrl = "img/3846510743.jpg",

                            Type = "MTB"
                        },
                        new Bike
                        {
                            AuctionPlatform = "Allegro.pl",
                           // PostedOn = DateTime.Now.AddDays(-5),
                            Description = "Almost brand new downhill-beast! Selling because my wife is jealous",
                            Name = "Kona",
                            Price = 3200.4,
                            ThumbnailUrl = "bootstrap/sample/kona.jpg",
                            SmallestThumbnailUrl = "img/3846510743.jpg",

                            Type = "Miejski"
                        },
                         new Bike
                        {
                            AuctionPlatform = "Allegro.pl",
                           // PostedOn = DateTime.Now.AddDays(-2),
                            Description = "fully equipped mountain bike, FOX Talas fork!",
                            Name = "Giant",
                            Price = 1200.4,
                            ThumbnailUrl = "bootstrap/sample/specialized.jpg",
                            SmallestThumbnailUrl = "img/3846510743.jpg",

                            Type = "Szosowy"
                        },
                      new Bike
                        {
                            AuctionPlatform = "Allegro.pl",
                           // PostedOn = DateTime.Now.AddDays(-1),
                            Description = "Black, carbon frame, 29 speeds, new set of tyres",
                            Name = "Trek",
                            Price = 1450.4,
                            ThumbnailUrl = "bootstrap/sample/specialized.jpg",
                            SmallestThumbnailUrl = "img/3846510743.jpg",

                            Type = "MTB"
                        }
                        
                };
            numberOfItemsFound = bikes.Count;

            return bikes;

        }

        public IEnumerable<Bike> GetLatestBikes()
        {
            int numberOfItemsFound;
            return GetBikes(null, 0, 0, 0, out numberOfItemsFound).Take(4);
            
        }
    }
}